// 充值
import { client } from '../../../request/index.js'
import Dialog from '../../../miniprogram_npm/@vant/weapp/dialog/dialog'

Page({
  data: {
    bankCard: '无',
    imgIp: getApp().globalData.imgIp,
  },
  onLoad: function (options) {
    this.userInformation()
  },
  toinPut1: function () {
    this.setData({
      money: 1,
    })
  },

  toinPut2: function () {
    this.setData({
      money: 5,
    })
  },

  toinPut3: function () {
    this.setData({
      money: 10,
    })
  },
  //用户信息
  async userInformation() {
    const sessId = getApp().globalData.sessionid
    const getData = await client({
      url: '/account/detail',
    })
    console.log('用户信息', getData)
    this.setData({
      aCoin: getData.data.data.aCoin,
      gCoin: getData.data.data.gCoin,
      userId: getData.data.data.userId,
    })
  },
  //立即兑换
  reCharge: function () {
    //充值
    Dialog.alert({
      title: '提示',
      message: '该功能尚未开放,试试别的吧~',
    })
  },

  onPullDownRefresh: function () {
    this.setData({
      money: '',
    })
    this.userInformation()
    setTimeout(() => {
      wx.stopPullDownRefresh()
    }, 1000)
  },
})
